// SPDX-FileCopyrightText: 2023-2025 Sangfor Technologies Inc.
// SPDX-License-Identifier: Mulan PSL v2
package com.geniusai.aip.auth.service;

import com.geniusai.aip.auth.domain.UserDO;
import com.geniusai.aip.auth.domain.edsentity.EdsKeysResponse;
import com.geniusai.aip.auth.domain.edsentity.EdsBucketDTO;
import com.geniusai.aip.auth.domain.edsentity.EdsCreateUserDTO;
import com.geniusai.aip.auth.domain.edsentity.EdsDecryptKeysResponse;
import com.geniusai.aip.auth.domain.edsentity.EdsLoginResponse;
import org.springframework.http.ResponseEntity;
import org.springframework.util.MultiValueMap;

import java.util.List;

/**
 * @author wys13822
 * @date 2021/7/13
 * @description
 **/
public interface EdsService extends StorageService {

    /**
     * 登陆EDS
     *
     * @param username 用户名
     * @param password 密码
     * @return EdsLoginResponseDTO
     */
    ResponseEntity<EdsLoginResponse> edsLogin(String username, String password);

    /**
     * 获取EDS accessKey secreteKey
     *
     * @param headers headers
     * @return EdsCreateKeysResponseDTO
     */
    ResponseEntity<EdsKeysResponse> edsGetKeys(MultiValueMap<String, String> headers);

    /**
     * 解密EdsSecreteKey
     *
     * @param token        token
     * @param cookie       cookie
     * @param verifyEntity eds身份验证实体
     * @param accessKey    accessKey
     * @param secreteKey   secreteKey
     * @return EdsDecryptKeysResponseDTO
     */
    ResponseEntity<EdsDecryptKeysResponse> edsDecryptKey(ResponseEntity<String> verifyEntity, String token, String cookie, String accessKey, String secreteKey);

    /**
     * 解密EdsSecreteKey
     *
     * @param headers headers
     * @return EdsDecryptKeysResponseDTO
     */
    ResponseEntity<String> edsVerify(MultiValueMap<String, String> headers);

    /**
     * 创建EdsUsers
     *
     * @param edsCreateUsersDTO edsUsers实体
     * @param headers           headers
     */
    void edsCreateUser(EdsCreateUserDTO edsCreateUsersDTO, MultiValueMap<String, String> headers);

    /**
     * Eds创建Buckets
     *
     * @param edsBucketDTO Eds创建Buckets实体
     * @param headers      headers
     */
    void edsCreateBucket(EdsBucketDTO edsBucketDTO, MultiValueMap<String, String> headers);

    /**
     * Eds删除用户
     *
     * @param deleteBucketsList 删除用户list
     * @param deleteUsersList   删除BucketsList
     * @return EdsDeleteResponseDTO
     */
    void edsDeleteUsers(List<String> deleteBucketsList, List<String> deleteUsersList);

    /**
     * Create Eds Users and Buckets
     *
     * @param userDO 用户实体
     * @return UserDO
     */
    UserDO edsCreateUserBucket(UserDO userDO);

    /**
     * Create Eds Bucket
     *
     * @param userDO 用户实体
     * @return UserDO
     */
    UserDO edsCreateBucketOnly(UserDO userDO);

    /**
     * Delete Eds Buckets
     *
     * @param deleteBucketsList 删除用户list
     */
    void edsDeleteBucket(List<String> deleteBucketsList);

}
